package com.sync.mutiParse;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel.MapMode;

import com.constants.Base;
import com.constants.Constants;

public class ResultWrite extends Base {
	public static void writeToFile(byte[] data) {
		File file = new File(RESULT_HOME + Constants.RESULT_FILE_NAME);
		RandomAccessFile resultRDFile = null;
		try {
			resultRDFile = new RandomAccessFile(file, "rw");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		try {
			MappedByteBuffer mappedByteBuffer = resultRDFile.getChannel()
					.map(MapMode.READ_WRITE, 0, data.length);
			mappedByteBuffer.put(data);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
